//
//  GYProductCateModel.m
//  GYDemo
//
//  Created by Mrzhang on 2018/3/26.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYProductCateModel.h"
#import "Head.h"

@implementation CategoryDetailModel

@end
@implementation GYProductCateModel
+(instancetype)shareInterface
{
    static GYProductCateModel *manager;
    kDISPATCH_ONCE_BLOCK(^{
        if (!manager) {
            manager = [GYProductCateModel new];
        }
    });
    return manager;
}
-(NSMutableArray *)dataSource
{
    if (!_dataSource) {
        _dataSource=[[NSMutableArray alloc] init];
    }
    return _dataSource;
}
-(NSMutableArray *)secLevelArr
{
    if (!_secLevelArr) {
        _secLevelArr=[[NSMutableArray alloc] init];
    }
    return _secLevelArr;
}
-(NSMutableArray *)pickViewDataSource
{
    if (!_pickViewDataSource) {
        _pickViewDataSource=[[NSMutableArray alloc] init];
    }
    return _pickViewDataSource;
}

-(void)requestCategory
{
    @WeakSelf;
    NSMutableDictionary *para = [[NSMutableDictionary alloc]init];
    NSString *inter = @"productCategory";
    [[InterfaceManager shareInterface]requetInterface:inter withParameter:para handler:^(NSDictionary *info,InterfaceStatusModel *infoModel) {
        NSArray *data = [infoModel.data objectForKey:@"list"];
        NSMutableArray* hh=[[NSMutableArray alloc] initWithArray:data];
        NSMutableArray *typemarr = [NSMutableArray new];
        if ([data isKindOfClass:[NSArray class]]) {
            for (NSDictionary *dic in data) {
                GYProductCateModel* model=[[GYProductCateModel alloc] init];
                model.titleStr=[[dic objectForKey:@"productType"] objectForKey:@"name"];
                model.secLevelArr=[dic objectForKey:@"list"];

             [typemarr addObject:model];
            }
        }
        [selfp setDataSource:typemarr];
        GYProductCateModel* model=typemarr[0];
        [selfp setSecLevelArr:model.secLevelArr];
        [selfp setPickViewDataSource:hh];
    }];
}
@end
